<%@page import="com.xe.gae.model.XEResource"%>
<%@page import="com.xe.gae.control.XEDataStorageService"%>
<html>
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="/_xe/codemirror/lib/codemirror.css">
    <script src="/_xe/jquery-1.9.1.min.js"></script>
    <script src="/_xe/codemirror/lib/codemirror.js"></script>
    <script src="/_xe/codemirror/addon/edit/matchbrackets.js"></script>
    
    <script src="/_xe/codemirror/mode/xml/xml.js"></script>
    <script src="/_xe/codemirror/mode/javascript/javascript.js"></script>
    <script src="/_xe/codemirror/mode/css/css.js"></script>
    
    <script src="/_xe/codemirror/mode/groovy/groovy.js"></script>
    <link rel="stylesheet" href="/_xe/codemirror/doc/docs.css">
    <style>
        .CodeMirror {
        border: 0px solid #eee;
        height: auto;
        CodeMirror-lines:10;
      }
      .CodeMirror-linenumbers {10}
      .CodeMirror-scroll {
        overflow-y: hidden;
        overflow-x: auto;
      }
      .CodeMirror-activeline-background {background: #e8f2ff !important;}
      </style>
      <script type="text/javascript">
      	 function doRun(){	
      		editor.doRun();
    		$.post("/_xe/admin", $("#editform").serialize());
      	 }
      </script>
  </head>
  <body>
  <table>
  <tr  height="100%" valign="top">
  <td width="100%" align="left">
	    <form id="editform" name="editform" >
	    <table>
	    <tr>
	    <td>
	        <input type="button" value="run" onclick="doRun();">
	        <input type="hidden" name="action" id="action" value="runScript"/>
	    </td>
	    </tr>
	    </table>
	    <textarea id="code" name="code"></textarea>
	    </form>
	    <script>
	      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
	    	  mode: "text/x-groovy", 
	    	  tabMode: "indent",
	    	  lineNumbers: true,
	    	  styleActiveLine: true,
	    	  lineWrapping: true  
	      });
	    </script>
    </td>
 </tr>
</table>
  </body>
</html>
